public class Narcissistic {
    public static void main(String[] args) {
        for (int i = 0; i < 99999; i++) {
            int count = 0;
            int sum = 0;
            int tmp = i;
            while(tmp!=0){
                count++;
                tmp/=10;
            }
            tmp = i;
            while(tmp!=0){
                sum += Math.pow(tmp%10,count);
                tmp/=10;
            }
            if(sum==i){
                System.out.println(i+"是水仙花数");
            }
        }
    }
}
